/**
 * @param {number} x
 * @return {number}
 */
var mySqrt = function (x) {
  let left = 1;
  while (left <= x) {
    if (left * left <= x && (left + 1) * (left + 1) > x) {
      return left;
    }
    left++;
  }
};

const ans = mySqrt(1);
console.log("ans: ", ans);
